//友元函数
#include <iostream>
#include <string.h>
#include <unistd.h>
using namespace std;

class Time
{
    int hour;
    int minute;
    int second;
public:
    Time(int h=0, int m=0, int s=0):hour(h),minute(m),second(s){}
    friend ostream &operator<<(ostream &out,Time &t);
};

//类外重载输出运输符（cout << t）
ostream &operator<<(ostream &out,Time &t)
{
    out.width(2);
    out.fill('0');
    out << t.hour << ":";

    out.width(2);
    out << t.minute << ":";

    out.width(2);
    out << t.second;
    return out;
}

int main(int argc, char const *argv[])
{
    Time t1(1,50,57);
    Time t2(0,20,43);

    cout << t1 << endl;
    cout << t2 << endl;
}